<template>
  <div class="terrain-analysis">
    <el-card class="analysis-panel">
      <template #header>
        <div class="card-header">
          <span>地形分析</span>
        </div>
      </template>

      <el-form :model="formData" label-width="100px">
        <el-form-item label="分析类型">
          <el-select v-model="formData.analysisType" placeholder="选择分析类型">
            <el-option label="坡度分析" value="slope" />
            <el-option label="坡向分析" value="aspect" />
            <el-option label="可视域分析" value="viewshed" />
            <el-option label="等高线生成" value="contour" />
          </el-select>
        </el-form-item>

        <el-form-item label="分析区域">
          <el-select v-model="formData.analysisArea" placeholder="选择分析区域">
            <el-option label="当前视图" value="current" />
            <el-option label="自定义区域" value="custom" />
            <el-option label="选中区域" value="selected" />
          </el-select>
        </el-form-item>

        <el-form-item label="等高距" v-if="formData.analysisType === 'contour'">
          <el-input-number v-model="formData.contourInterval" :min="1" :step="1" controls-position="right">
            <template #suffix>米</template>
          </el-input-number>
        </el-form-item>

        <el-form-item label="观察点位置" v-if="formData.analysisType === 'viewshed'">
          <el-input v-model="formData.viewPoint" placeholder="x,y,z" />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="performTerrainAnalysis"> 执行分析 </el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script setup>
import { reactive } from "vue";

const formData = reactive({
  analysisType: "slope",
  analysisArea: "current",
  contourInterval: 10,
  viewPoint: "",
});

const performTerrainAnalysis = () => {
  console.log("执行地形分析", formData);
};
</script>

<style scoped>
.terrain-analysis {
  padding: 15px;
}

.analysis-panel {
  max-width: 500px;
}

.card-header {
  font-weight: bold;
}
</style>
